package com.gimi.cloud.bbp.manage.controller.order;


import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gimi.cloud.bbp.common.enums.ResponseCodeEnum;
import com.gimi.cloud.bbp.common.utils.reqhead.Response;
import com.gimi.cloud.bbp.dto.order.OrderGoodsDTO;
import com.gimi.cloud.bbp.manage.service.order.OrderGoodsService;
                                                                                                                                                                                                                     /**
 * 订单管理
 * @author chendi
 * @date 2018年1月12日
 */
@RestController
@RequestMapping(value = "orderGoods")
public class OrderGoodsController {
	
	@Autowired
    private OrderGoodsService orderGoodsService;
	
	/** 获得单个订单商品信息 */
    @RequestMapping(value = "/getSingleOrderGoods")
    public Response getSingleOrderGoods(@RequestBody OrderGoodsDTO DTO, HttpServletResponse response) throws Exception {
    	Response resp = new Response();
    	OrderGoodsDTO orderGoods = orderGoodsService.getSingleOrderGoods(DTO);
    	resp.setRes_data(orderGoods);
        resp.setResponseCode(ResponseCodeEnum.SUCCESSED);
        return resp;
    }
    
    
    /** 修改订单订单商品信息 */
    @RequestMapping(value = "/updateOrderGoods")
    public Response updateOrderGoods(@RequestBody OrderGoodsDTO DTO, HttpServletResponse response) throws Exception {
    	Response resp = new Response();
    	orderGoodsService.updateOrderGoods(DTO);
    	resp.setResponseCode(ResponseCodeEnum.SUCCESSED);
    	return resp;
    }
    /**删除订单商品信息**/
    @RequestMapping(value = "/deleteOrderGoods")
    public Response deleteOrderGoods(@RequestBody OrderGoodsDTO DTO, HttpServletResponse response) throws Exception {
    	Response resp = new Response();
    	orderGoodsService.deleteOrderGoods(DTO);
    	resp.setResponseCode(ResponseCodeEnum.SUCCESSED);
    	return resp;
    }
    
    
}
